<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/template/template_dialog.xhtml">
	<ui:define name="head">
		<title>#{request.getParameter('selectName')}  生产计划分析</title>
		<link rel="stylesheet"
			href="#{request.contextPath}/resources/plugins/datatables/jquery.dataTables.min.css" />
		<style>
.dataTable th {
	white-space: nowrap !important;
}
.box-header {
	background-color: #3c8dbc;
	color: white;
	font-family: "SimHei";
}

</style>
	</ui:define>
	<ui:define name="content">
		<div class="row">
			<div class="col-xs-12">				
				<div id="d1" class="box">
					<div class="box-body">
					
					 <div id="main" style="width: 500px;height: 300px;margin: 0 auto"> 
					  
					 </div>					  			
					<table id="example2" class="table table-bordered table-hover">
							
					</table>
					</div>
			
				</div>
			</div>
			
		</div>
		<h:inputHidden id="lineName"
			value="#{request.getParameter('selectName')}"></h:inputHidden>
	</ui:define>

	<ui:define name="contentend">	
	    <script src="#{request.contextPath}/resources/js/mycharts/charts.js"></script>
	    <script src="#{request.contextPath}/resources/plugins/echarts/echarts.js"></script>
		<script src="#{request.contextPath}/resources/plugins/datatables/jquery.dataTables.min.js"></script>
		<script src="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
		
		<script src="#{request.contextPath}/resources/js/array-util.js"></script>		
		<script>
		
		  var namearray=['已完成','待确认','执行中','已取消','待发布','未派工','新增'];
		  var myc=new Echart3NormalRing("main");
		  
		  var tb = $('#example2').DataTable({
			     "language": {
		        	"url": "/resources/plugins/datatables/Chinese.json"
		           },
			      "paging": true,//禁止表格分页
			      "lengthChange": false,
			      "searching": true,
			      "ordering": false,
			      "info": true,
			      "autoWidth": true,	       
			       columns:[
			        {"title":"计划编号"}, 
			        {"title":"计划类型"}, 
			        {"title":"计划性质"}, 
			        {"title":"工作类别"}, 
			        {"title":"工作班组"}, 
			        {"title":"工作地点"}, 
			        {"title":"工作内容"},
			        {"title":"工作负责人"}, 
			        {"title":"计划状态"},
			        ]
			        
		   });
		  
		  $(function(){	      
			  $.getJSON("/rest/pms/getPmsPlanCount",function(result){
				    $.each(result, function(i, field){
				      for(var k=0;field.length>k;k++){
				    	  myc.addDataNameValue(namearray[k],field[k]);  			    	 
				      }		
				      myc.setLegendLabels(namearray);
				      myc.show();				     
				     			    
				    });
				  });               
		  });
		  myc.getChart().on("click",function(params){
	    	  
	    	  $.getJSON("/rest/pms/getPmsPlanByStatus/"+params.name,function(result){				   				    		     		 
	    		
	    		  tb.clear().rows.add(result).draw();	    		 
	    	  });
	    	  
	      });
		</script>
	</ui:define>
</ui:composition>